using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;

namespace WebApiFrame.Filters
{
    public class SimpleResourceFilterAttribute : Attribute, IResourceFilter
    {
        private readonly ILogger<SimpleResourceFilterAttribute> logger;

        public SimpleResourceFilterAttribute(ILoggerFactory loggerFactory)
        {
         logger=loggerFactory.CreateLogger<SimpleResourceFilterAttribute>();
        }
        public void OnResourceExecuted(ResourceExecutedContext context)
        {
        logger.LogInformation("资源过滤器 OnResourceExecuted");
        }

        public void OnResourceExecuting(ResourceExecutingContext context)
        {
             logger.LogInformation("资源过滤器 OnResourceExecuting");
        }
    }
}